<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
</head>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">

            <fieldset class="table-search-fieldset">
                <legend>搜索信息</legend>
                <div style="margin: 10px 10px 10px 10px">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">授权名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="roleName" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <button type="submit" class="layui-btn layui-btn-primary" lay-submit
                                    lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                            </div>
                        </div>
                    </form>
                </div>
            </fieldset>
            <script type="text/html" id="toolbarDemo">
                <div style="display: inline-block;"><div class="layui-btn layui-btn-sm layui-btn-primary" title="添加" lay-event="add"> <i class="layui-icon layui-icon-add-1"></i></div><div class="layui-btn layui-btn-sm layui-btn-primary" title="全部展开" lay-event="expandAll">全部展开</div><div class="layui-inline layui-btn layui-btn-sm layui-btn-primary" title="全部折叠" lay-event="foldAll">全部折叠</div></div>
            </script>
            <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
            <script type="text/html" id="currentTableBar">
                <div class="layui-btn layui-btn-primary layui-btn-xs data-count-add" lay-event="add"><i class="layui-icon layui-icon-add-1"></i></div><div class="layui-btn layui-btn-primary layui-btn-xs data-count-edit" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></div><div class="layui-btn layui-btn-primary layui-btn-xs data-count-delete" lay-event="delete"><i class="layui-icon layui-icon-delete"></i></div>
            </script>
            <script type="text/html" id="authNameTpl">
                {{#  if(d.authIcon === ''){ }}
                    <span class="layui-left-nav">{{d.authName}}</span>
                {{#  } else { }}
                    <i class="fa {{d.authIcon}}"></i><span class="layui-left-nav">{{d.authName}}</span>
                {{#  } }}
              </script>
        </div>
    </div>
    <script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
    <script src="../../js/lay-config.js?v=2.0.0" charset="utf-8"></script>
    <script>
        var tableConfig = {
            editMode:0,
            editFormIdx:0,
            tableIdx:0,
            // 表格请求数据地址
            deleteOneUrl: "/dicms/api/desktop/sys_auth/deleteOne",
            deleteOneToManyUrl: "/dicms/api/desktop/sys_auth/deleteMany",
            addPageUrl: '../../page/auth/edit.html',
            editPageUrl: '../../page/auth/edit.html',
            currRowObject:{},
            currRowPObject:{},
            tableOptions:{
                    elem: '#currentTableId',
                    url: '/dicms/api/desktop/sys_auth/findAll',
                    toolbar: '#toolbarDemo',//'default',//
                    height: 'full-200',
                    // skin: 'line',
                    tree: {
                        iconIndex: 1,
                        isPidData: true,
                        idName: 'id',
                        pidName: 'pid'
                    },
                    defaultToolbar: ['filter', 'print', 'exports', {
                        title: '提示',
                        layEvent: 'LAYTABLE_REFRESH',
                        icon: 'layui-icon-refresh'
                    }],
                    cols: [
                        [
                            { type: 'numbers' },
                            { field: 'authName', title: '授权名称' , minWidth: 165,templet: '#authNameTpl' },
                            { field: 'authUrl', title: '权限URL', width: 300, },
                            // { field: 'path', title: 'path' },
                            { field: 'authTypeName', title: '权限类型名称' },
                            { field: 'sort', title: '排序值' },
                            { align: 'center', toolbar: '#currentTableBar', title: '操作', width: 160 }
                        ]
                    ],
                    style: 'margin-top:0;'
                }
        };
        layui.use(['common'], function () {
            layui.common.initTreeTableView(tableConfig);
        });
        
    </script>

</body>

</html>